#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <stdio.h>
#include <unistd.h>
#include <assert.h>
#include <math.h>
#include "flymap_vsync.h"



int main()
{
    int dev;
    struct flymap_trigger_info trig_info = {0};

    trig_info.trigger_timestamp = 123;
    trig_info.exp_timestamp = 12345;
    trig_info.frame_no = 1;
    trig_info.v_active_timestamp = 123;
    trig_info.v_total_timestamp = 22345;


    dev = open("/dev/flymap_vsync", O_RDONLY);
	if (dev <= 0) {
		printf("flymap_vsync device open fail\n");
		exit(0);
	}

    printf("asdf\n");

    while (1) {
        ioctl(dev, FLYMAP_TRIGGER_IO_EVENT, &trig_info);

        printf("trigger_timestamp : %lld\n", trig_info.trigger_timestamp);
        printf("frame_timestamp : %lld\n", trig_info.frame_timestamp);

        trig_info.frame_no += 30;
        trig_info.v_active_timestamp += 30;
        trig_info.v_total_timestamp += 30;

        sleep(1);
    }

    return 0;
}
